<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

defined('ANS') or die();

$Data->execute('check.php', true);

$ids = explode(',', $Vars->get('id'));

foreach ($ids as $k => $i) {
	$ids[$k] = intval(trim($i));

	if (!$ids[$k]) {
		unset($ids[$k]);
	}
}

$ok = $Admin->delete(array(
	'table' => $Vars->get('table'),
	'id' => $ids
));

if ($ok) {
	redirect(path(true, true, 'list'));
} else {
	$Vars->message(__('There was an error deleting the row %s in the table %s', $Vars->get('id'), $Vars->get('table')));
}

return false;
?>